﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    /// <summary>
    /// 使用asc码排序的字典
    /// </summary>
    /// <typeparam name="TValue"></typeparam>
    public class AsciiSortedDictionary<TValue> : SortedDictionary<string, TValue>
    {
        /// <summary>
        /// 使用asc码排序的字典
        /// </summary>
        public AsciiSortedDictionary() : base(new StringKeyAsciiComparer())
        {

        }
        private class StringKeyAsciiComparer : IComparer<string>
        {
            /// <summary>
            /// 
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public int Compare(string x, string y)
            {
                return string.Compare(x, y, StringComparison.Ordinal);               
            }
        }
    }
}
